<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2022/5/16
  Time: 16:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>指挥部</title>
</head>
<body>
<div>
    <h1 class="text-center">指挥部角色</h1>
    <p>总指挥：<a href="/admin/addCommandPost">增加成员</a></p>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>职务</th>
            <th>部门职务</th>
            <th>姓名</th>
            <th>办公电话</th>
            <th>手机</th>
            <th>住宅电话</th>
            <th>其他电话</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table1">

        </tbody>

    </table>
    <p>副总指挥：<a href="/admin/addCommandPost">增加成员</a></p>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>职务</th>
            <th>部门职务</th>
            <th>姓名</th>
            <th>办公电话</th>
            <th>手机</th>
            <th>住宅电话</th>
            <th>其他电话</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table2">

        </tbody>

    </table>
    <p>安全副矿长：<a href="/admin/addCommandPost">增加成员</a></p>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>职务</th>
            <th>部门职务</th>
            <th>姓名</th>
            <th>办公电话</th>
            <th>手机</th>
            <th>住宅电话</th>
            <th>其他电话</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table3">

        </tbody>

    </table>
    <p>救护大队：<a href="/admin/addCommandPost">增加成员</a></p>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>职务</th>
            <th>部门职务</th>
            <th>姓名</th>
            <th>办公电话</th>
            <th>手机</th>
            <th>住宅电话</th>
            <th>其他电话</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="table4">

        </tbody>

    </table>
</div>
</body>
<script type="text/javascript">
    $("#save").click(function () {
        alert("发送成功")
        window.location.href="troubleRemoval"
    })
    $("#qiuxiao").click(function () {
        window.location.href="troubleRemoval"
    })

    $(function () {
        $.ajax({
            url:"/dir/queryCommandere",
            method:"get",
            dataType:"json",
            success:function (data) {
                for (var i=0;i<data.length;i++){
                    var text="<tr><td>"+data[i].name+"</td> <td>"+data[i].position+"</td> <td>"+data[i].user_name+"</td> <td>"+data[i].phonenum+"</td> <td>"+data[i].telephone+"</td> <td>"+data[i].otherphone+"</td> <td>"+data[i].officephone+"</td><td><input id='"+data[i].id+"' type='hidden' value='"+data[i].id+"'><a href='javascript:'>编辑</a>--<a href='javascript:'>删除</a></td>"
                    $("#table1").append(text)


                    $("#"+data[i].id).next("a").click(function () {
                        var id=$(this).prev().val()
                        window.location.href=("/admin/editorialHeadquarters/"+id)
                    })


                    $("#"+data[i].id).next("a").next("a").click(function () {
                        var id=$(this).prev().prev().val()
                        var searchMap = {
                            "id":id
                        };
                        var msg = "您真的确定要删除吗？！";
                        if (confirm(msg)==true) {
                            $.ajax({
                                url: '/dir/deleteCommandere',
                                type: 'delete',
                                dataType: 'json',
                                data: JSON.stringify(searchMap),
                                contentType: "application/json",
                                success: function () {
                                    alert("删除成功")
                                    window.location.href = "/admin/systemSettings";

                                },
                                error: function () {
                                    alert("删除失败")
                                }
                            })
                        }else {

                        }
                    })

                }
            }


        })
        $.ajax({
            url:"/dir/queryDeputySafetyDirecto",
            method:"get",
            dataType:"json",
            success:function (data) {
                for (var i=0;i<data.length;i++){
                    var text="<tr><td>"+data[i].name+"</td> <td>"+data[i].position+"</td> <td>"+data[i].user_name+"</td> <td>"+data[i].phonenum+"</td> <td>"+data[i].telephone+"</td> <td>"+data[i].otherphone+"</td> <td>"+data[i].officephone+"</td><td><input id='"+data[i].id+"' type='hidden' value='"+data[i].id+"'><a href='javascript:'>编辑</a>--<a href='javascript:'>删除</a></td>"
                    $("#table3").append(text)


                    $("#"+data[i].id).next("a").click(function () {
                        var id=$(this).prev().val()
                        window.location.href=("/admin/editorialHeadquarters/"+id)
                    })


                    $("#"+data[i].id).next("a").next("a").click(function () {
                        var id=$(this).prev().prev().val()
                        var searchMap = {
                            "id":id
                        };
                        var msg = "您真的确定要删除吗？！";
                        if (confirm(msg)==true) {
                            $.ajax({
                                url: '/dir/deleteCommandere',
                                type: 'delete',
                                dataType: 'json',
                                data: JSON.stringify(searchMap),
                                contentType: "application/json",
                                success: function () {
                                    alert("删除成功")
                                    window.location.href = "/admin/systemSettings";

                                },
                                error: function () {
                                    alert("删除失败")
                                }
                            })
                        }else {

                        }
                    })

                }
            }


        })
        $.ajax({
            url:"/dir/queryViceCommandere",
            method:"get",
            dataType:"json",
            success:function (data) {
                for (var i=0;i<data.length;i++){
                    var text="<tr><td>"+data[i].name+"</td> <td>"+data[i].position+"</td> <td>"+data[i].user_name+"</td> <td>"+data[i].phonenum+"</td> <td>"+data[i].telephone+"</td> <td>"+data[i].otherphone+"</td> <td>"+data[i].officephone+"</td><td><input id='"+data[i].id+"' type='hidden' value='"+data[i].id+"'><a href='javascript:'>编辑</a>--<a href='javascript:'>删除</a></td>"
                    $("#table2").append(text)


                    $("#"+data[i].id).next("a").click(function () {
                        var id=$(this).prev().val()
                        window.location.href=("/admin/editorialHeadquarters/"+id)
                    })


                    $("#"+data[i].id).next("a").next("a").click(function () {
                        var id=$(this).prev().prev().val()
                        var searchMap = {
                            "id":id
                        };
                        var msg = "您真的确定要删除吗？！";
                        if (confirm(msg)==true) {
                            $.ajax({
                                url: '/dir/deleteCommandere',
                                type: 'delete',
                                dataType: 'json',
                                data: JSON.stringify(searchMap),
                                contentType: "application/json",
                                success: function () {
                                    alert("删除成功")
                                    window.location.href = "/admin/systemSettings";

                                },
                                error: function () {
                                    alert("删除失败")
                                }
                            })
                        }else {

                        }
                    })

                }
            }


        })
        $.ajax({
            url:"/dir/queryRescueBrigade",
            method:"get",
            dataType:"json",
            success:function (data) {
                for (var i=0;i<data.length;i++){
                    var text="<tr><td>"+data[i].name+"</td> <td>"+data[i].position+"</td> <td>"+data[i].user_name+"</td> <td>"+data[i].phonenum+"</td> <td>"+data[i].telephone+"</td> <td>"+data[i].otherphone+"</td> <td>"+data[i].officephone+"</td><td><input id='"+data[i].id+"' type='hidden' value='"+data[i].id+"'><a href='javascript:'>编辑</a>--<a href='javascript:'>删除</a></td>"
                    $("#table4").append(text)


                    $("#"+data[i].id).next("a").click(function () {
                        var id=$(this).prev().val()
                        window.location.href=("/admin/editorialHeadquarters/"+id)
                    })


                    $("#"+data[i].id).next("a").next("a").click(function () {
                        var id=$(this).prev().prev().val()
                        var searchMap = {
                            "id":id
                        };
                        var msg = "您真的确定要删除吗？！";
                        if (confirm(msg)==true) {
                            $.ajax({
                                url: '/dir/deleteCommandere',
                                type: 'delete',
                                dataType: 'json',
                                data: JSON.stringify(searchMap),
                                contentType: "application/json",
                                success: function () {
                                    alert("删除成功")
                                    window.location.href = "/admin/systemSettings";

                                },
                                error: function () {
                                    alert("删除失败")
                                }
                            })
                        }else {

                        }
                    })

                }
            }


        })
    })


</script>
</html>
